package day013.bigDecimal;

import java.math.BigDecimal;

public class BigDecimalDemo {
    public static void main(String[] args) {
        BigDecimal bigDecimal1 = new BigDecimal("0.1");
        BigDecimal bigDecimal2 = new BigDecimal("0.2");
        BigDecimal add = bigDecimal1.add(bigDecimal2);

        System.out.println(add);
        System.out.println("=============================");

        BigDecimal subtract = bigDecimal1.subtract(bigDecimal2);
        System.out.println(subtract);

        System.out.println("=============================");

        BigDecimal multiply = bigDecimal1.multiply(bigDecimal2);
        System.out.println(multiply);

        System.out.println("=============================");

        BigDecimal divide = bigDecimal1.divide(bigDecimal2, 3, BigDecimal.ROUND_UP);
//        BigDecimal divide=bigDecimal1.divide(bigDecimal2,3,BigDecimal.ROUND_FLOOR);
//        BigDecimal divide=bigDecimal1.divide(bigDecimal2,3,BigDecimal.ROUND_HALF_UP);
        System.out.println(divide);
    }
}
